<template>
  <div>
      <van-cell>
      <!-- 标题区域的插槽 -->
      <template #title>
        <div class="title-box">
          <!-- 标题 -->
          <span>{{obj.title}}</span>
          <img class="thumb" v-lazy="obj.cover.images[0]" alt="" v-if="obj.cover.type === 1">
        </div>
        <div v-if="obj.cover.type > 1" class="thumb-box">
            <img v-lazy="item" alt="" class="thumb" v-for="(item,index) in obj.cover.images" :key="index">
        </div>
      </template>
      <!-- label 区域的插槽 -->
      <template #label>
        <div class="label-box">
          <span>{{`${obj.aut_name} ${obj.comm_count}评论 ${obj.pubdate}`}}</span>
          <!-- 关闭按钮 -->
          <van-icon name="cross" @click.stop="btn(obj.art_id)"/>
        </div>
      </template>
    </van-cell>
  </div>
</template>

<script>
export default {
  props: {
    obj: Object
  },
  methods: {
    btn (artid) {
      this.$emit('close', artid)
    }

  }
}
</script>

<style scoped lang="less">
.title-box { // 标题样式
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.label-box { // label描述样式
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.thumb {
  // 矩形黄金比例：0.618
  width: 113px;
  height: 70px;
  background-color: #f8f8f8;
  object-fit: cover;
}

.thumb-box {
  display: flex;
  justify-content: space-between;
}
</style>
